package com.njust.config;


import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

@Configuration
public class FileUploadConfig {

    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        DataSize unlimitedSize = DataSize.ofBytes(-1);
        factory.setMaxFileSize(unlimitedSize);
        factory.setMaxRequestSize(unlimitedSize);
        return factory.createMultipartConfig();
    }
}
